package com.lzs.adx.web.commmon.utils;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;


/**
 * 返回数据统一封装
 */
@Data
@Accessors(chain = true)
public class ChatResult<T> implements Serializable {

    /**
     * 业务状态码 (必需)
     */
    private String code;
    /**
     * 业务消息
     */
    private String message;
    /**
     * 数据
     */
    private T data;


    public static final String waitDraw="10000";

    public static <T> ChatResult<T> error() {
        ChatResult ChatResult =new ChatResult();
        ChatResult.setCode("500");
        ChatResult.setMessage("系统异常,请稍后再试");
        return ChatResult;
    }


    public static <T> ChatResult<T> error(String code, String msg) {
        ChatResult ChatResult =new ChatResult();
        ChatResult.setCode(code);
        ChatResult.setMessage(msg);
        return ChatResult;
    }


    public static <T> ChatResult<T> waitDraw(String code) {
        ChatResult ChatResult =new ChatResult();
        ChatResult.setCode(code);
        ChatResult.setMessage("当前使用绘画人数较多，请等等稍后执行");
        return ChatResult;
    }




    public static <T> ChatResult<T> ok(T data) {
        ChatResult ChatResult =new ChatResult();
        ChatResult.setCode("0");
        ChatResult.setMessage("成功");
        ChatResult.setData(data);
        return ChatResult;
    }

    public static <T> ChatResult<T> ok() {
        ChatResult ChatResult =new ChatResult();
        ChatResult.setCode("0");
        ChatResult.setMessage("成功");
        return ChatResult;
    }




}